<section class="">
	<h6 class="c-g-content c-infor-title">
		<span>近期播放</span>
	</h6>
	<article class="dqkc-list mb30">
		<!-- /无数据提示 开始-->
		<!--如果没有最近直播时间-->
		<#if !liveTime??>
			<section class="no-data-wrap liveNoData"><!--直播已经开始-->
				<em class="icon30 no-data-ico">&nbsp;</em> <span class="c-666 fsize14 ml10 vam">最近没有直播<a href="/course/list.html" class="c-master f-fM fsize14"></a>！</span>
			</section>
		</#if>
		<!--如果有最近直播时间-->
		<#if liveTime??>
			<!--若果直播时间到现在时间大于0 说明直播还没开始-->
			<#if liveTime gt 0>
				<section class="no-data-wrap liveCoutTime"><!--直播未开始 倒计时 最近开始的一节课-->
					<em class="icon30 no-data-ico">&nbsp;</em>
					<span class="ml10 vam disIb">
					<p class="hLh30 c-666 fsize14 f-fM syD mt5" id="showTimes">直播倒计时：<tt class="f-fM">0</tt>天<tt class="f-fM">0</tt>时<tt class="f-fM">0</tt>分<tt class="f-fM">0</tt>秒</p>
					<p class="hLh30 c-red fsize12 f-fM mt5">提示：直播开始前15分钟才能进入直播大厅哦！！！</p>
				</span>
				</section>
				<div class="clearfix cous-new-late">
				<span class="fl vam">
					<em class="icon20 lh-p-icon-live-xz">&nbsp;</em>
					<tt class="vam fsize16 c-master f-fM">${courseNode.name}</tt>
				</span>
					<span class="fr mr20">
					<tt class="vam fsize12 f-fM c-666">
						${courseNode.liveBeginTime?string("MM-dd HH:mm")}~
						${courseNode.liveEndTime?string("HH:mm")}
						直播
					</tt>
				</span>
				</div>
			</#if>
			<!-- /无数据提示 结束-->
		<!--若果直播时间到现在时间小于0 说明正在直播-->
			<#if liveTime lt 0>
				<div class="clearfix cous-new-late">
				<span class="fl vam">
					<em class="icon20 lh-p-icon-live-xz">&nbsp;</em>
					<tt class="vam fsize16 c-master f-fM">${courseNode.name}</tt>
				</span>
					<span class="fr vam">
					<a href="javascript:livePlay(${courseNode.nodeId})"   class="cou-kscp" title="进入直播">进入直播</a>
				</span>
					<span class="fr mr20">
					<img src="/static/qdxwx/img/live-ing.gif" width="100%" height="100%" class="vam disIb">
				</span>
				</div>
			</#if>
		</#if>
	</article>
</section>
<section class="">
	<h6 class="c-g-content c-infor-title">
		<span>直播目录</span>
	</h6>
	<menu id="lh-menu" class="lh-menu">
		<ul>
			<#list courseNodeTree as parentLivePoint>
				<#if parentLivePoint.nodeType==0>
					<li class="lh-menu-stair">
						<a class="l-m-stitle current-1" href="javascript:livePlay(${childNode.nodeId})" title="${parentLivePoint.name}">

							<span class="fr">
								<em class="icon16 m-tree-icon">&nbsp;</em>
							</span>


								${parentLivePoint.name}
						</a>
						<ol class="lh-menu-ol" >
							<!--父级节点下的子节点-->
							<#list parentLivePoint.children as childNode>
							<!--开始时间小于当前时间结束时间大于当前时间 为正在直播-->
								<#if childNode.liveBeginTime?datetime?long lt .now?datetime?long && childNode.liveEndTime?datetime?long gt .now?datetime?long >

									<li class="lh-menu-second">
										<div class="l-m-stitle clearfix">
								<span class="fr">
										<a class="cou-kscp" href="javascript:livePlay(${childNode.nodeId})"  title="进入直播">进入直播</a>
								</span>
											<span class="fr mr20">
									<img src="/static/qdxwx/img/live-ing.gif" width="100%" height="100%" class="vam disIb">
								</span>
											<a class="cou-tit-txt" href="javascript:livePlay(${childNode.nodeId})" title="${childNode.name}" >${childNode.name}</a>
										</div>
									</li>
								</#if>
							<!--开始时间大于当前时间 为未开始直播-->
								<#if childNode.liveBeginTime?datetime?long gt .now?datetime?long>
									<li class="lh-menu-second">
										<div class="l-m-stitle clearfix">
								<span class="fr">
									<#if (.now?datetime?long +900000) gt  childNode.liveBeginTime?datetime?long>
										<a  class="cou-kscp gmkc" href="javascript:void(0)" title="未开始">未开始</a><!--点击弹出提示 开播之前15分钟可以进入-->
									</#if>
									<#if (.now?datetime?long +900000) lt childNode.liveBeginTime?datetime?long>
										<a  class="cou-kscp" href="javascript:livePlay(${childNode.nodeId})" title="马上开始">马上开始</a><!--开播之前15分钟后按钮变色-->
									</#if>
									</span>
											<span class="fr mr20">
									<tt class="vam fsize12 f-fM c-master">
										${childNode.liveBeginTime?string("yyyy-MM-dd HH:mm")}~
										${childNode.liveEndTime?string("HH:mm")}
										</tt>
								</span>
											<a class="cou-tit-txt" title="${childNode.name}" onclick="" href="javascript:livePlay(${childNode.nodeId})">${childNode.name}</a>
										</div>
									</li>
								</#if>
							<!--结束时间大于当前时间 为结束直播-->

								<#if childNode.liveEndTime?datetime?long lt .now?datetime?long >
									<li class="lh-menu-second">
										<div class="l-m-stitle clearfix">
								<span class="fr">
									<a  class="cou-kscp" href="javascript:livePlay(${childNode.nodeId})"  title="查看回放">查看回放</a>
								</span>
											<span class="fr mr20">
									<tt class="vam fsize12 f-fM c-666">
										${childNode.liveBeginTime?string("yyyy-MM-dd HH:mm")}~
										${childNode.liveEndTime?string("HH:mm")}
										</tt>
								</span>
											<a class="cou-tit-txt" title="${childNode.name}"  href="javascript:livePlay(${childNode.nodeId})">${childNode.name}</a>
										</div>
									</li>
								</#if>
							</#list>
						</ol>
					</li>
				</#if>
				<!--如果父节点不是目录-->
				<#if parentLivePoint.nodeType!=0>
				<!--开始时间小于当前时间结束时间大于当前时间 为正在直播-->
					<#if parentLivePoint.liveBeginTime?date?long lt .now?date?long && parentLivePoint.liveEndTime?date?long gt .now?date?long>
						<li class="lh-menu-second">
							<div class="l-m-stitle clearfix">
								<span class="fr">
										<a class="cou-kscp" href="javascript:livePlay(${parentLivePoint.nodeId})"  title="进入直播">进入直播</a>
								</span>
								<span class="fr mr20">
									<img src="/static/qdxwx/img/live-ing.gif" width="100%" height="100%" class="vam disIb">
								</span>
								<a class="cou-tit-txt" href="javascript:livePlay(${parentLivePoint.nodeId})" title="${parentLivePoint.name}" >${parentLivePoint.name}</a>
							</div>
						</li>
					</#if>
				<!--开始时间大于当前时间 为未开始直播-->
					<#if parentLivePoint.liveBeginTime?date?long gt .now?date?long>
						<li class="lh-menu-second">
							<div class="l-m-stitle clearfix">
								<span class="fr">
									<#if (.now?datetime?long + 900000) gt parentLivePoint.liveBeginTime?datetime?long>
										<a  class="cou-kscp gmkc" href="javascript:void(0)" title="未开始">未开始</a><!--点击弹出提示 开播之前15分钟可以进入-->
									</#if>
									<#if (.now?datetime?long + 900000) lt parentLivePoint.liveBeginTime?datetime?long>
										<a  class="cou-kscp" href="javascript:livePlay(${parentLivePoint.nodeId})" title="马上开始">马上开始</a><!--开播之前15分钟后按钮变色-->
									</#if>
									</span>
								<span class="fr mr20">

									<tt class="vam fsize12 f-fM c-master">

										${parentLivePoint.liveBeginTime?string("yyyy-MM-dd HH:mm")}~
										${parentLivePoint.liveEndTime?string("yyyy-MM-dd HH:mm")}
										</tt>
								</span>
								<a class="cou-tit-txt" title="${parentLivePoint.name}" onclick="" href="javascript:livePlay(${parentLivePoint.nodeId})">${parentLivePoint.name}</a>
							</div>
						</li>
					</#if>
				<!--结束时间大于当前时间 为结束直播-->
					<#if parentLivePoint.liveEndTime?date?long lt .now?date?long>
						<li class="lh-menu-second">
							<div class="l-m-stitle clearfix">
								<span class="fr">
									<a  class="cou-kscp" href="javascript:livePlay(${parentLivePoint.nodeId})"  title="查看回放">查看回放</a>
								</span>
								<span class="fr mr20">
									<tt class="vam fsize12 f-fM c-666">
										${parentLivePoint.liveBeginTime?string("yyyy-MM-dd HH:mm")}~
										${parentLivePoint.liveEndTime?string("yyyy-MM-dd HH:mm")}
										</tt>
								</span>
								<a class="cou-tit-txt" title="${parentLivePoint.name}"  href="javascript:livePlay(${parentLivePoint.nodeId})">${parentLivePoint.name}</a>
							</div>
						</li>
					</#if>
				</#if>
			</#list>
		</ul>
	</menu>
</section>

<script>
	$(function () {
		conDowFun();//直播倒计时
		treeMenu();
		checkLivePercent();
	});
	/*判断直播进度*/
	function checkLivePercent() {
		var parentSize = ${parentNodeSize} + "";
		var childSize = ${childNodeSize} + "";
		var overNode = ${overNode} + "";
		$(".parentKopintCount").html(parentSize);
		$(".childKopintCount").html(childSize);
		$(".childKopint").html(overNode + "/共" + childSize + "节");
		$(".livePercent").css("width", overNode / childSize * 100 + "%");
		if (overNode / childSize < 1) {
			$(".livePercent").addClass("bg-green")
		} else if (overNode / childSize == 1) {
			$(".livePercent").addClass("bg-orange")
		}
	}
	//直播倒计时
	function conDowFun() {
		var second = ${liveTime!0}; // 剩余秒数

		ss = second % 1000;
		second = (second - ss) / 1000;
		//写一个方法，将秒数专为天数
		if (second > 0) {
			var toDays = function () {
				var s = second % 60; // 秒
				if (s < 10) {
					s = "0" + s;
				}
				var mi = (second - s) / 60 % 60; // 分钟
				var h = ((second - s) / 60 - mi) / 60 % 24; // 小时
				if (h < 10) {
					h = "0" + h;
				}
				var d = (((second - s) / 60 - mi) / 60 - h) / 24; // 天
				return "直播倒计时：<tt>" + d + "</tt>天<tt>" + h + "</tt>时<tt>" + mi + "</tt>分<tt>" + s + "</tt>秒";
			};
			//然后写一个定时器
			window.setInterval(function () {
				if (second > 0) {
					second--;
				}
				document.getElementById("showTimes").innerHTML = toDays();
			}, 1000);
		}
	}
</script>